package com.pc.store.util;



import lombok.Data;

import java.io.Serializable;

/**
 * 采用Json格式进行相应，需要实现Serializable接口
 * @param <E>
 */
@Data
public class JsonResult<E> implements Serializable {
    //状态码
    private  Integer state;
    //描述信息
    private String message;
    //泛型的数据类型
    private  E data;

    public JsonResult(){}

    public JsonResult(Integer state){
        this.state = state;
    }
    public JsonResult(Integer state, E data){
        this.state = state;
        this.data = data;
    }
    public JsonResult(Throwable e){
        this.message = e.getMessage();
    }
}
